package com.dnjn.happiness.system.api;

import com.dnjn.happiness.common.core.constant.SecurityConstants;
import com.dnjn.happiness.common.core.constant.ServiceNameConstants;
import com.dnjn.happiness.common.core.domain.R;
import com.dnjn.happiness.system.api.domain.SysDept;
import com.dnjn.happiness.system.api.factory.RemoteDeptFallbackFactory;
import com.dnjn.happiness.system.api.model.TeamTreeSelectVO;
import com.dnjn.happiness.system.api.model.TreeSelectVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteDeptService",value = ServiceNameConstants.SYSTEM_SERVICE,fallbackFactory = RemoteDeptFallbackFactory.class)
public interface RemoteDeptService {

    @GetMapping(value = "/dept/getInfoById/{deptId}")
    public R<SysDept> getInfoById(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept/selectDeptList")
    public R<List<SysDept>> selectDeptList(SysDept dept,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept/getListAll")
    public R<List<Long>> getListAll(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept/getDeptListByDeptId/{deptId}")
    public R<List<SysDept>> getDeptListByDeptId(@PathVariable("deptId") Long deptId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/dept/getDeptTreeApi")
    public R<List<TreeSelectVO>> getDeptTreeApi(SysDept dept,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping("/dept//getChildDeptListById/{deptId}")
    public R<List<SysDept>> getChildDeptListById(@PathVariable("deptId") Long deptId,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept/selectDeptByChildUserId/{deptId}")
    public R<SysDept> selectDeptByChildUserId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept/selectSuperDeptList/{userId}")
    public R<SysDept> selectSuperDeptList(@PathVariable("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping(value = "/system/dept/selectTeamTreeList")
    public R<List<TeamTreeSelectVO>> selectTeamTreeList(@RequestBody SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @GetMapping(value = "/dept//getTeamTreeByDeptId/{deptId}")
    public R<List<TeamTreeSelectVO>> getTeamTreeByDeptId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
